// @Author EthanScriptOn
// @Desc
package config_parser

import (
	"gitee.com/fatzeng/srf_switch_config/config_context"
	"gitee.com/fatzeng/srf_switch_config/config_define"
)

type ResourceParser interface {
	ParsePrepare(ctx *config_context.ConfigInitializationContext) error
	Parse(ctx *config_context.ConfigInitializationContext, unresolvedData interface{}) error
	ParseDoMore(ctx *config_context.ConfigInitializationContext) error
	StageParseResult(ctx *config_context.ConfigInitializationContext) error
	StageParseResultDoMore(ctx *config_context.ConfigInitializationContext) error
	GetStageParseResult(ctx *config_context.ConfigInitializationContext) interface{}
}

type RepeatResourceParser interface {
	ResourceParser
	RepeatParse(ctx *config_context.ConfigInitializationContext) error
	GetDuplicateLoadingRuleInstanceList() ([]*DuplicateLoadingList, error)
}

type ResourceFreighter interface {
	FreightPrepare(ctx *config_context.ConfigInitializationContext) error
	Freight(ctx *config_context.ConfigInitializationContext, resolvedData interface{}) error
	FreightDoMore(ctx *config_context.ConfigInitializationContext) error
}

type CustomizedDuplicateLoadingFunc func(ctx *config_context.ConfigInitializationContext, segmentVal interface{}) ([]string, error)

type DuplicateLoadingList struct {
	NodeElemType                   config_define.NodeElemType
	CustomizedDuplicateLoadingFunc CustomizedDuplicateLoadingFunc
}
